package ms.platform.util;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class Base64Utils {

	public static String base64_encode(String str) throws Exception{
		BASE64Encoder encoder = new BASE64Encoder();
		return encoder.encode(str.getBytes("ISO-8859-1"));
	}
	
	public static String base64_encode(byte[] bytes) throws Exception{
		BASE64Encoder encoder = new BASE64Encoder();
		return encoder.encode(bytes);
	}
	
	public static byte[] base64_decode(String str) throws Exception{
		BASE64Decoder decoder = new BASE64Decoder();
		return decoder.decodeBuffer(str);
	}
}
